package com.ushine.web.component.task.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @Author: yls
 * @Date: 2022/02/22 00:31
 * @Description: 自定义异常处理类
 * @Version 1.0
 */
@Slf4j
@Component
public class TemplateAsyncExceptionHandler implements AsyncUncaughtExceptionHandler {
    @Override
    public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
        log.info("==》捕获线程异常信息");
        log.info("==》捕获线程异常信息：Exception message - " + throwable.getMessage());
        log.info("==》捕获线程异常信息：Method name - " + method.getName());
        for (Object param : objects) {
            log.info("==》捕获线程异常信息：Parameter value - " + param);
        }
    }
}
